package com.example.my.meila.presenter;

import com.example.my.meila.api.BaseSubscriber;
import com.example.my.meila.api.ExceptionHandle;
import com.example.my.meila.entity.Global;
import com.example.my.meila.model.ModelFactory;
import com.example.my.meila.view.impl.GlobalView;

/**
 * Created by My on 2016/10/31.
 */
public class GlobalPresenter{
    public GlobalView globalView;

    public GlobalPresenter(GlobalView globalView) {
        this.globalView = globalView;
    }
    public void getGlobalData(){
        ModelFactory.getiGlobalModel().getGlobalData(new BaseSubscriber<Global>() {
            @Override
            public void onSuccess(Global global) {
                globalView.onSuccess(global);
            }

            @Override
            public void onFail(ExceptionHandle.ResponeThrowable e) {
                 globalView.onFail(e);
            }

            @Override
            public void onFinished() {
               globalView.onFinish();
            }
        });
    }
}
